﻿using System;
using System.Diagnostics;
using System.IO;

namespace Growatt.UploadPacktest
{


    public class FileChecker
    {
        private string folderPath;
        private string fileName;

        public FileChecker(string folderPath, string fileName)
        {
            this.folderPath = folderPath;
            this.fileName = fileName;
        }

        public bool FileExists()
        {
            try
            {
                // 构建完整的文件路径
                string fullFilePath = Path.Combine(folderPath, fileName);

                // 检查文件是否存在
                bool exists = File.Exists(fullFilePath);

                if (exists)
                {
                    Debug.WriteLine($"文件 {fileName} 存在于文件夹 {folderPath} 中。");
                }
                else
                {
                    Debug.WriteLine($"文件 {fileName} 不存在于文件夹 {folderPath} 中。");
                }

                return exists;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"发生异常: {ex.Message}");
                return false;
            }
        }
    }

    // 示例用法

}